package it.heima.xmy.demo;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class PoetryReadDemo {
    public static void main(String[] args) {
File file =new File("F:\\123.txt");
readPoetry(file);

    }

    public static void readPoetry(File file) {
        //创建字符输入流对象
        FileReader fr = null;
        try {
            fr = new FileReader(file);
           int s= -1;
            char[] ch =new char[1024];
            while ((s=fr.read(ch))!=-1){
                System.out.println(new String(ch,0 ,s));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fr.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
